import Env from './Env'
const wechat = {
  oauth2: ({appid, redirectUri, responseType = 'code', scope = 'snsapi_userinfo', state = 'WECHAT'} = {}) => {
	appid = appid || Env.getH5AppID()
	redirectUri = encodeURIComponent(redirectUri || Env.getLoginUrl())
    let oauth2URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appid + '&redirect_uri=' + redirectUri + '&response_type=' + responseType + '&scope=' + scope + '&state=' + state + '#wechat_redirect'
    console.log('### oauth2URL ###', oauth2URL)
    window.location.href = oauth2URL
  }
}

export default wechat